Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@turf/rhumb-distance
Advanced tools
@turf/rhumb-distance is a module from the Turf.js library that calculates the rhumb line distance between two geographical points. A rhumb line is a path of constant bearing, which is different from the shortest path (great-circle distance) on a sphere. This package is useful for applications that require consistent bearing, such as navigation and mapping.
Calculate Rhumb Distance
This feature calculates the rhumb line distance between two geographical points. The `units` option allows you to specify the unit of measurement, such as miles, kilometers, etc.
const turf = require('@turf/turf');
const point1 = turf.point([-75.343, 39.984]);
const point2 = turf.point([-75.534, 39.123]);
const options = { units: 'miles' };
const distance = turf.rhumbDistance(point1, point2, options);
console.log(distance);
Geolib is a library for geospatial calculations. It provides various methods for distance calculations, including great-circle distance and rhumb line distance. Compared to @turf/rhumb-distance, Geolib offers a broader range of geospatial functions but may not be as specialized in rhumb line calculations.
Geodesy is a library that provides tools for geodesic calculations. It includes methods for calculating distances, bearings, and other geospatial properties. While it offers comprehensive geodesic calculations, it may require more configuration compared to the straightforward usage of @turf/rhumb-distance.
Calculates the distance along a rhumb line between two points in degrees, radians, miles, or kilometers.
from
Coord origin point
to
Coord destination point
options
Object? Optional parameters
options.units
string can be degrees, radians, miles, or kilometers (optional, default "kilometers"
)var from = turf.point([-75.343, 39.984]);
var to = turf.point([-75.534, 39.123]);
var options = {units: 'miles'};
var distance = turf.rhumbDistance(from, to, options);
//addToMap
var addToMap = [from, to];
from.properties.distance = distance;
to.properties.distance = distance;
Returns number distance between the two points
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
$ npm install @turf/rhumb-distance
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf
FAQs
turf rhumb-distance module
The npm package @turf/rhumb-distance receives a total of 543,774 weekly downloads. As such, @turf/rhumb-distance popularity was classified as popular.
We found that @turf/rhumb-distance demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.